<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <meta name="wap-font-scale" content="no">  <!--解决UC字体忽然变大-->
    <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1">
    
        <?php if(!empty($page["title"])): ?><title><?php echo ($page["title"]); ?></title>
            <?php else: ?>
            <title><?php echo ($setting["sitename"]); ?></title><?php endif; ?>
    
    <?php if(!empty($page["keywords"])): ?><meta name="keywords" content="<?php echo ($page["keywords"]); ?>"/>
        <?php else: ?>
        <meta name="keywords" content="<?php echo ($setting["keywords"]); ?>"/><?php endif; ?>
    <?php if(!empty($page["description"])): ?><meta property="description" name="description" content="<?php echo ($page["description"]); ?>"/>
        <?php else: ?>
        <meta property="description" name="description" content="<?php echo ($setting["description"]); ?>"/><?php endif; ?>

    
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--bootstrap组件--><link rel="stylesheet" href="/Public/bootstrap/bootstrap.min.css" ><script src="/Public/bootstrap/jquery.min.js" ></script><script src="/Public/bootstrap/popper.min.js"></script><script src="/Public/bootstrap/bootstrap.min.js"></script><!--awesome字体--><link href="/Public/bootstrap/font/css/font-awesome.min.css" rel="stylesheet"><!--bootstrap-dialog--><script src="/Public/bootstrap/bootstrap.dialog.js"></script><!--拖拽--><!--<script type="text/javascript" src="/Public/Plugs/jq/jquery-ui.min.js"></script>--><!--文件上传--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/uploadify/uploadify.css"><script type="text/javascript" src="/Public/Plugs/uploadify/jquery.uploadify.min.js"></script>--><!--滚动条--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.css"/><script type="text/javascript" src="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.js"></script>--><!--颜色选择器--><link rel="stylesheet" type="text/css" href="/Public/Plugs/spectrum/spectrum.css"><script type="text/javascript" src="/Public/Plugs/spectrum/spectrum.js"></script><!--弹出框--><script type="text/javascript" src="/Public/Plugs/jq/jquery-dialog.js"></script><!--新日历控件,来源  http://blog.csdn.net/binyao02123202/article/details/42066035--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/calendar/cxcalendar.css"/><script type="text/javascript" src="/Public/Plugs/calendar/calendar.js"></script>--><!--日期选择器插件datetimepicker--><link rel="stylesheet" href="/Public/Plugs/flatpickr/flatpickr.min.css"><script type="text/javascript" src="/Public/Plugs/flatpickr/flatpickr.js"></script><script type="text/javascript" src="/Public/Plugs/flatpickr/zh.js?v=3"></script><!--文件上传-插件地址：https://github.com/danielm/uploader--><script src="/Public/Plugs/dmuploader/jquery.dm-uploader.js"></script><!--ueditor--><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.config.js"></script><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.all.js"></script><link rel="stylesheet" type="text/css" href="/Public/Plugs/ueditor/third-party/video-js/video-js.css"><script type="text/javascript" src="/Public/Plugs/ueditor/third-party/video-js/video.js"></script><!--app--><link rel="stylesheet" type="text/css" href="/Public/Admin/css/style.css"/><script type="text/javascript" src="/Public/Admin/js/common_admin.js"></script>
    
</head>
<body>

<div class="g-page-in">
        <div class="u-breadcrumb">        <a class="back" href="javascript:history.back()" ><span class="fa fa-chevron-left"></span> 后退</a>        <a class="back" href="javascript:window.location.reload()" ><span class="fa fa-repeat"></span> 刷新</a>        <span class="name">编辑分类</span>    </div>    <div class="h15"></div>    <div class="nav nav-tabs" role="tablist">        <a class="nav-item nav-link active" data-toggle="tab" href="#nav-1" role="tab" aria-selected="true">基本信息</a>        <a class="nav-item nav-link" data-toggle="tab" href="#nav-2" role="tab" aria-selected="false">附加值</a>    </div>    <div class="h15"></div>    <form method="post" enctype="multipart/form-data">        <input name="id" type="hidden" value="<?php echo ($page["id"]); ?>" />        <div class="tab-content">            <div class="tab-pane fade show active" id="nav-1" role="tabpanel">                <div class="form-group">                    <label><span class="text-danger">* </span>分类名称</label>                    <div class="form-inline">                        <input type="text" class="form-control mr-2" name="name_cn" placeholder="分类名称" style="width:400px;" value="<?php echo ($page["name_cn"]); ?>" />                    </div>                    <small class="form-text text-muted"></small>                </div>                <div class="form-group">                    <label>英文名称</label>                    <div class="form-inline">                        <input type="text" class="form-control mr-2" name="name_en" placeholder="英文名称" style="width:400px;" value="<?php echo ($page["name_en"]); ?>" />                    </div>                    <small class="form-text text-muted"></small>                </div>                <div class="form-group">                    <label>缩略图</label>                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><div id="upload_img_one" class="upload_img_one">	<div class="upload_img_one_left">		<div class="pic">			<?php if(empty($page["thumb"])): ?><img src="/Public/Admin/images/nopicture.png" width="100" />				<?php else: ?>				<img src="<?php echo ($page["thumb"]); ?>" width="160" /><?php endif; ?>			<span class="size"></span>			<a class="delete" href="#" data="/Public/Admin/images/nopicture.png">×</a>		</div>		<input class="thumb_path" type="hidden" name="thumb" value="$page.thumb" />        <label id="upload_upload_img_one" class="u-dmuploader">            <span role="button" class="btn btn-sm btn-primary w-100 mt-1"><span class="fa fa-upload"></span> 上传图片</span>            <input type="file" class="dis_none" />        </label>	</div>	<div class="upload_img_one_right">		<div class="tip">格式支持jpg、png、gif，图片大小&lt;6MB</div>		<div><a class="blue hide_btn" href="#">地址图片</a></div>		<div class="add_block">			<input class="text add_text" type="text" value="" />			<div class="add_btn">添加</div>		</div>	</div>	<div class="clear"></div></div><script type="text/javascript">	//显示-隐藏 缩略图地址添加	$("#upload_img_one .upload_img_one_right a.hide_btn").click(function() {	    var $this = $(this);		if($this.text() == '地址图片') {            $this.parent().siblings('.add_block').show();            $this.text('收起');		} else {            $this.parent().siblings('.add_block').hide();            $this.text('地址图片');		}		return false;	});	//添加缩略图地址	$(".upload_img_one_right .add_btn").click(function(){	    var $this = $(this);		var $val = $this.siblings('.add_text').val();		if($.trim($val) != '') {			$("#upload_img_one .upload_img_one_left .pic").find('img').attr({'src':$val});			$("#upload_img_one .thumb_path").val($val);		}	});	//删除当前选中缩略图	$("#upload_img_one .upload_img_one_left .pic a.delete").click(function(){		var nopicture = $(this).attr('data');		$("#upload_img_one .upload_img_one_left .pic").find('img').attr({'src':nopicture});		$("#upload_img_one .thumb_path").val('');		$(".upload_img_one_left .pic span.size").hide();	});	//初始化上传uploadify	$size = 6;  //单位：M    //插件地址：https://github.com/danielm/uploader    $('#upload_upload_img_one').dmUploader({        url: '<?php echo U("Common/upload_pic_one");?>',        dataType: 'json',        maxFileSize : $size*1024*1024,  //允许上传的大小，单位KB        allowedTypes: 'image/*',        multiple:false,        extraData:{            '<?php echo session_name();?>' : '<?php echo session_id();?>'        },        onComplete: function(){            //$.danidemo.addLog('#demo-debug', 'default', 'All pending tranfers completed');            console.log('All pending tranfers completed');        },        onUploadProgress: function(id, percent){            //var percentStr = percent + '%';            //$.danidemo.updateFileProgress(id, percentStr);        },        onUploadSuccess: function(id, res){            if(res.status == 1){                $("#upload_img_one .upload_img_one_left .pic").find('img').attr({'src':res.path});                $("#upload_img_one .upload_img_one_left .pic .size").text(res.width+"×"+res.height).show();                $("#upload_img_one .thumb_path").val(res.path);            } else {                $boot.error($data.info);            }        },        onUploadError: function(id, message){        },        onFileTypeError: function(file){        },        onFileSizeError: function(file){        },        onFileExtError: function(file){        },        onFallbackMode: function(message){        }    });</script>                    <small class="form-text text-muted"></small>                </div>            </div>            <div class="tab-pane fade show" id="nav-2" role="tabpanel">                <div class="mod_cate_edit_001">                    <div class="form-inline">                        字段名(中文)：<input class="form-control form-control-sm w-80 mr-3" type="text" id="title" />                        字段标识(en)：<input class="form-control form-control-sm w-80 mr-3" type="text" id="identify" />                        组件类型：                        <select class="form-control form-control-sm mr-3" id="widget">                            <?php if(is_array($widget)): $i = 0; $__LIST__ = $widget;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["identify"]); ?>"><?php echo ($vo["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>                        </select>                        是否需要真实字段：                        <select class="form-control form-control-sm mr-3" id="need_real_fields">                            <option value="0">不需要</option>                            <option value="1">需要</option>                        </select>                        字段备注：<input class="form-control form-control-sm w-80 mr-3" type="text" id="remark" />                        <button class="btn btn-sm btn-primary" id="btn_add_attr" type="button">新增</button>                    </div>                    <div class="h10"></div>                    <table class="table table-bb">                        <tr>                            <th>ID</th>                            <th>字段名</th>                            <th>字段标识</th>                            <th>组件类型</th>                            <th>是否需要真实字段</th>                            <th>字段备注</th>                            <th width="140">操作</th>                        </tr>                        <?php if(is_array($attrlist)): $i = 0; $__LIST__ = $attrlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="tr_<?php echo ($vo["id"]); ?>">                                <td><?php echo ($vo["id"]); ?></td>                                <td><?php echo ($vo["title"]); ?></td>                                <td><?php echo ($vo["identify"]); ?></td>                                <td><?php echo ($vo["widget"]); ?></td>                                <td><?php echo ($vo["need_real_fields"]); ?></td>                                <td><?php echo ($vo["remark"]); ?></td>                                <td>                                    <a class="blue" href="<?php echo U('ArticleAttr/edit',array('id'=>$vo['id'],'cateid'=>$_GET['id']));?>">编辑</a>&nbsp;&nbsp;&nbsp;                                    <a class="blue" action-href="<?php echo U('ArticleAttr/delete',array('id'=>$vo['id'],'cateid'=>$_GET['id']));?>" href="#" onclick="delete_attr(this);">删除</a>                                </td>                            </tr><?php endforeach; endif; else: echo "" ;endif; ?>                    </table>                </div>                <script>                    (function(){                        $("#btn_add_attr").click(function(){                            var $data = {                                title:$("#title").val(),                                identify:$("#identify").val(),                                widget:$("#widget").val(),                                need_real_fields:$("#need_real_fields").val(),                                remark:$("#remark").val(),                                cateid:$("input[name=id]").val(),                            };                            var url = "<?php echo U('ArticleCate/edit',array('id' =>$_GET['id'],'on'=>1));?>";                            $.ajax({                                type:"post",                                url:"<?php echo U('ArticleCate/ajax_add_attr');?>",                                data:$data,                                success:function(data){                                    if(data['status']){                                        window.location = url;                                    }                                }                            });                        });                    })();                </script>            </div>        </div>        <button type="submit" class="btn btn-primary">保存</button>    </form>    <script type="text/javascript">        function delete_attr(self){            $boot.confirm({text:"确定删除？"},function(){                window.location = $(self).attr('action-href');            });        }    </script>    <?php if(!empty($_GET['on'])): ?><script>            var on_tag = "<?php echo ((isset($_GET['on']) && ($_GET['on'] !== ""))?($_GET['on']):0); ?>";            $(".nav-item").removeClass('active').eq(on_tag).addClass('active');            $(".tab-pane").removeClass('active').eq(on_tag).addClass('active');        </script><?php endif; ?>
</div>

<script type="text/javascript" src="/Public/Admin/js/my.js"></script>
</body>
</html>